﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <script src="~/plugins/mzui/js/mzui.min.js"></script>
    <link href="~/plugins/mzui/css/mzui.min.css" rel="stylesheet" />
    <title>我的消费</title>
</head>
<body class="with-nav-bottom">
    <table class="table bordered white">
        <thead>
            <tr class="purple-pale">
                <th>订单/消费商家</th>
                <th>折扣价</th>
                <th>原价</th>
            </tr>
        </thead>
        <tbody id="tbody">
            <script id="tpl" type="text/html">
                {{each list as item index}}
                <tr>
                    <td>{{item.order_no}}</td>
                    <td>{{item.rmb}}</td>
                    <td>{{item.amount}}</td>
                </tr>
                <tr>
                    <td>{{item.name}}</td>
                    <td><button type="button" class="btn btn-sm primary" onclick="xfxx('{{item.zhekou}}');">消费详情</button></td>
                    <td><button type="button" class="btn btn-sm primary" onclick="fkxx('{{item.order_no}}','{{item.city}}{{item.address}}','{{item.lxfs}}','{{item.addtime}}','{{item.buygid}}','{{item.gid}}','{{item.pj}}');">详情评价</button></td>
                </tr>
                <tr>
                    <td colspan="3" class="text-center primary-pale text-red">支付时间 {{item.pay_time}}</td>
                </tr>
                {{/each}}
            </script>
        </tbody>
        <tfoot>
            <tr>
                <th colspan="4" id="nextpage" class="title text-center" onclick="getlist(document.getElementById('pageindex').innerHTML,0);">显示更多 <i class="icon icon-double-angle-down"></i></th>
            </tr>
        </tfoot>
    </table>
    <div id="fkxx" class="affix dock-bottom modal hidden" style="margin-bottom:50px;">
        <div class="heading">
            <div class="title">订单号:<strong id="order_no"></strong></div>
            <nav class="nav"><a onclick="closefk('fkxx');"><i class="icon-remove muted"></i></a></nav>
        </div>
        <table class="table bordered">
            <tbody>
                <tr>
                    <td>地址</td>
                    <td id="address"></td>
                </tr>
                <tr>
                    <td>电话</td>
                    <td id="lxfs"></td>
                </tr>
                <tr>
                    <td>下单</td>
                    <td id="addtime"></td>
                </tr>
                <tr>
                    <td>评分</td>
                    <td>
                        <div class="radio inline-block">
                            <input type="radio" id="hao" name="lr" value="1" onchange="setradio('1')">
                            <label for="lr">优</label>
                        </div>
                        <div class="radio inline-block">
                            <input type="radio" id="yb" name="lr" value="2" onchange="setradio('2')">
                            <label for="lr">合格</label>
                        </div>
                        <div class="radio inline-block">
                            <input type="radio" id="cha" name="lr" value="3" onchange="setradio('3')">
                            <label for="lr">差</label>
                        </div>
                        <div class="inline-block" data-display data-backdrop="true" data-target="#chahelp">
                            <div class="label primary-pale text-tint"><i class="icon icon-question"></i></div>
                        </div>
                        <input id="lx" name="lx" type="text" value="1" class="hidden">
                    </td>
                </tr>
                <tr id="img" class="hidden">
                    <td>图片</td>
                    <td class="control">
                        <input id="chaimg" type="file" />
                        <p id="chaimgbt" class="help-text has-error">差评请提供图片</p>
                    </td>
                </tr>
                <tr>
                    <td>评价</td>
                    <td><textarea type="text" id="msg" name="msg" style="height:58px;width:198px;"></textarea></td>
                </tr>
                <tr>
                    <td>回复</td>
                    <td id="tomsg"></td>
                </tr>
                <tr>
                    <td colspan="2" class="text-center">
                        对你的评分:<div id="pf" class="label primary outline">未评分</div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <input type="text" id="plgid" value="0" class="hidden">
                        <input type="text" id="cpgid" value="0" class="hidden">
                        <input type="text" id="ddgid" value="0" class="hidden">
                        <button type="button" id="pj" class="btn block primary" onclick="pj();">提交</button>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <!-- 差评说明 -->
    <div id="chahelp" class="affix dock-bottom modal hidden">
        <div class="heading">
            <div class="title"><strong>差评说明</strong></div>
            <nav class="nav"><a data-dismiss="display"><i class="icon-remove muted"></i></a></nav>
        </div>
        <div class="section">
            <div class="box">
                <p>
                    1.差评必须提交相关图片或文字，否则算恶意差评
                    <br />
                    2.差评出现允许12小时内协调修改    
                    <br />
                    3.恶意差评的人或商家将进入封闭期 
                    <br />
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;①可以消费
                    <br />
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;②十天暂停推荐会员
                    <br />
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;③十天之内取消专属推广费
                    <br />
                    4.有差评的（会员或商家）在个人页面上有表示
                    <br />
                    5.第二次差评，封闭期为20天（不推荐，无专属推广费）
                    <br />
                    6.第三次差评，直接取消会员（商家）资格，进入黑名单，终身无法被推荐进入最惠联盟。注册时会被提示拒绝（实名制）
                </p>
            </div>
        </div>
    </div>
    <!-- 消费详情 -->
    <div id="xfxx" class="affix dock-bottom modal hidden">
        <div class="heading">
            <div class="title"><strong>消费折扣清单</strong></div>
            <nav class="nav"><a onclick="closefk('xfxx');"><i class="icon-remove muted"></i></a></nav>
        </div>
        <div class="section">
            <div id="xf" class="box"></div>
        </div>
    </div>
    <div id="ss" class="affix dock-bottom modal hidden">
        <div class="section box">
            <div class="control has-success">
                <input name="lx" type="text" class="input" value="1">
            </div>
        </div>
    </div>
    <nav class="nav affix dock-bottom justified">
        <a href="/home/index">商城</a>
        <a href="/user/grzx" class="active text-info">我的</a>
    </nav>
    <label id="pageindex" class="hidden">0</label><label id="pages" class="hidden">1</label>
    <label id="Controllers" class="hidden">/user/orderlist</label>
    <script src="~/js/jquery.js"></script>
    <script src="~/js/template-web.js"></script>
    <script src="~/js/mlist.js"></script>
    <script src="~/js/image.js"></script>
    <script>
        $("#chaimg").on('change', function () {
            if ($("#plgid").val() != "0") {
                url = "/ajax/api.ashx?ff=chaimg";
                id = "chaimg";
                data = {
                    plgid: $("#plgid").val(),
                    lx: 1
                }
                loadImageFile(id);
            }
            else
            {
                alert("请先评价后在上传图片!");
            }
        });
        function setradio(lx) {
            document.getElementById("lx").value = lx;
            if (lx == 3) {
                $("#img").removeClass("hidden");
            }
            else
            {
                $("#img").addClass("hidden");
            }
        }
        function fkxx(order_no, address, lxfs, addtime, cpgid, ddgid, pj) {
            $("#xfxx").removeClass("hidden").addClass("hidden");
            $("#pj").text("提交");
            $("#plgid").val("0");
            $("#cpgid").val(cpgid);
            $("#ddgid").val(ddgid);
            if (pj != "") {
                var obj = eval('(' + pj + ')');
                $("#plgid").val(obj.gid);
                $("#msg").val(obj.msg);
                $("#tomsg").html(obj.tomsg);
                if (obj.userpj == 3) {
                    $("input[name='lr'][value='3']").attr("checked", true);
                    document.getElementById("lx").value = "3";
                    $("#img").removeClass("hidden");
                }
                else if (obj.userpj == 2) {
                    $("input[name='lr'][value='2']").attr("checked", true);
                    document.getElementById("lx").value = "2";
                }
                else {
                    $("input[name='lr'][value='1']").attr("checked", true);
                    document.getElementById("lx").value = "1";
                }
                if (obj.userpj == 1) {
                    $("#pf").text("优");
                }
                else if (obj.userpj == 3) {
                    $("#pf").text("差");
                }
                else {
                    $("#pf").text("合格");
                }
            }
            else
            {
                $("#msg").val("");
                $("#tomsg").html("未回复");
                $("input[name='lr'][value='1']").attr("checked", true);
                document.getElementById("lx").value = "1";
            }
            $("#order_no").html(order_no);
            $("#address").html(address);
            $("#lxfs").html(lxfs);
            $("#addtime").html(addtime);
            $("#fkxx").removeClass("hidden");
        }
        function pj() {
            if (document.getElementById("msg").value != "") {
                $.ajax({
                    url: "/ajax/api.ashx",
                    data: "ff=pj&cpgid=" + $("#cpgid").val() + "&plgid=" + $("#plgid").val() + "&ddgid=" + $("#ddgid").val() + "&lx=" + $("#lx").val() + "&pf=" + $("#lx").val()+"&msg=" + $("#msg").val() + "&Cache=" + Math.random(),
                    type: "post",
                    cache: false,
                    timeout: 8000,
                    dataType: "json",
                    ContentType: "application/json; charset=utf-8",
                    error: function () { alert("AJAX Error"); },
                    beforeSend: function () { },
                    success: function (data) {
                        $("#pj").text(data.data.msg);
                        $("#plgid").val(data.data.plgid);
                    },
                });
            }
            else
            {
                alert("请输入评价内容!");
            }
        }
        function closefk(div) {
            $("#" + div).addClass("hidden");
        }
        function xfxx(zhekou) {
            $("#fkxx").removeClass("hidden").addClass("hidden");
            document.getElementById("xf").innerHTML = zhekou;
            $("#xfxx").removeClass("hidden");
        }
    </script>
</body>
</html>